package cn.wolfcode.wolf2w.redis.util;

import cn.wolfcode.wolf2w.util.Consts;
import lombok.Getter;

/**
 * redis key管理
 */
@Getter
public enum RedisKeys {

    //用户攻略点赞
    USER_STRATEGY_THUMBUP("user_strategy_thumbup",-1L),
    //用户攻略收藏列表
    USER_STRATEGY_FAVOR_LIST("user_strategy_favor_list",-1L),
    //攻略统计
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L),
    //短信验证码
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME * 60L),
    //登录令牌
    USER_LOGIN_LOKEN("user_login_loken",Consts.USER_INFO_TOKEN_VAI_TIME * 60L);

    private String prefix;
    private Long time;

    private RedisKeys(String prefix, Long time){
        this.prefix = prefix;
        this.time = time;
    }
    public String join(String ...keys){
        StringBuilder sb = new StringBuilder();

        sb.append(prefix);
        for (String key : keys) {
            sb.append(":").append(key);
        }
        return sb.toString();
    }

}
